import 'package:flutter/material.dart';
// 1、基础知识点: Flex布局
void main() => runApp(MaterialApp(
  home: Home(),
));


// 封装自定义无状态Widget Home(保存后会自动热重载)
class Home extends StatelessWidget {
  // 重写无状态Widget build
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text(
            // 标题
            "我是标题",
            // 文字颜色
            style: TextStyle(
              color: Colors.white,
            ),
          ),
          centerTitle: true,
          // 颜色
          backgroundColor: Colors.blue[200],
        ),
        body: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Expanded(
                flex: 1,
                child: Container(
                  padding: EdgeInsets.all(20.0),
                  color: Colors.red,
                  child: Text(
                      "Row1"
                  ),
                ),
            ),
            Expanded(
              flex: 3,
              child: Container(
                padding: EdgeInsets.all(2.0),
                color: Colors.green,
                child: ElevatedButton(
                    onPressed: () {},
                    child: Text('ElevatedButton')
                ),
              ),
            ),
            Expanded(
              flex: 1,
              child: Container(
                color: Colors.amber,
                child: Text("Container"),
              ),
            )
          ],
        )
    );
  }
}